﻿using System;
using System.Collections.Generic;
using System.Data;
using PPI.General;
using PPI.WebConsumer.PPI.Svc;

namespace PPI.WebConsumer.Inspection
{
    public class WInspection
    {
        public static Int32 Save(Int32 inspectionId, double latitude, double longitude, Int32 year, DateTime lVisit, string number, DateTime acquisitionDate, Int32 treatmentFk, Int32 classFk, Int32 SpecieFk, Int32 ToptypeFk, Int32 length, Int32 inspectorFk, Int32 companyFk, Int32 mapFk, Int32 projectFk, Int32 contactFk, Int32 assetFk, Int32 sectionFk, Int32 guardsQuantity, bool poleTag, bool billable, bool groundWireRepair, string lastCompanyName, int vendorVisitTypeFk)
        {
            ConfigReader reader = ConfigReader.GetInstance();
            PPI.Svc.Service1 svc = new Service1();

            return svc.Inspections_Save(inspectionId, latitude, longitude, year, lVisit, number, acquisitionDate, treatmentFk, classFk, SpecieFk, ToptypeFk, length, inspectorFk, companyFk, mapFk, projectFk, contactFk, assetFk, sectionFk, guardsQuantity, poleTag, billable, groundWireRepair, lastCompanyName, vendorVisitTypeFk, reader.ConectionMode);
        }

        public static DataSet GetInspectionById(Int32 inspectionId)
        {
            ConfigReader reader = ConfigReader.GetInstance();
            PPI.Svc.Service1 svc = new Service1();
            return svc.Inspections_GetByInspectionResult(inspectionId, reader.ConectionMode);
        }

        public static void SetVisit(Int32 inspectionId, Int32 visitId)
        {
            ConfigReader reader = ConfigReader.GetInstance();
            PPI.Svc.Service1 svc = new Service1();
            svc.Inspections_SetVisit(inspectionId, visitId,reader.ConectionMode);
        }

        public static Int32 NewVisit(Int32 inspectionId, List<Int32> inspectionList)
        {
            ConfigReader reader = ConfigReader.GetInstance();
            PPI.Svc.Service1 svc = new Service1();
            return svc.Inspections_NewVisit(inspectionId, inspectionList.ToArray(), reader.ConectionMode);
        }

        public static Int32 CreateRemedy(Int32 inspectionPoleFk, DateTime discoveredDate,Int32 inspectionResultTypeFk)
        {
            ConfigReader reader = ConfigReader.GetInstance();
            PPI.Svc.Service1 svc = new Service1();
            return svc.Inspections_CreateRemedy(inspectionPoleFk, discoveredDate, inspectionResultTypeFk, reader.ConectionMode);
        }

        public static void UpdateRemedy(Int32 remedyId, Int32 remedyStatusFk, string remedyAssigned, DateTime remedyLastAction, DateTime remedyResolvedDate, string remedyNotes)
        {
            ConfigReader reader = ConfigReader.GetInstance();
            PPI.Svc.Service1 svc = new Service1();
            svc.Inspections_UpdateRemedy(remedyId,remedyStatusFk,remedyAssigned,remedyLastAction,remedyResolvedDate,remedyNotes, reader.ConectionMode);
        }

        public static void Delete(Int32 structureId)
        {
            ConfigReader reader = ConfigReader.GetInstance();
            PPI.Svc.Service1 svc = new Service1();
            svc.InspectionStructure_Delete(structureId, reader.ConectionMode);
        }

        public static void DeleteWithPoles(Int32 structureId)
        {
            ConfigReader reader = ConfigReader.GetInstance();
            PPI.Svc.Service1 svc = new Service1();
            svc.InspectionStructure_DeleteWithPoles(structureId, reader.ConectionMode);
        }
    }
}
